/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-07-28
 * Time: 22:16
 */
class Solution21 {
    public int brokenCalc(int startValue, int target) {
        int count = 0;

        while(target > startValue) {
            if(target % 2 == 1) {
                target += 1;
            }else  {
                target /= 2;
            }
            count++;
        }
        return count + startValue - target;
    }
}